package com.sky.mapper;

import com.sky.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.HashMap;
import java.util.Map;

@Mapper
public interface UserMapper {
    /**
     * 查询微信登录用户是否存在
     * @param openId
     * @return
     */
    @Select("select * from user where openid = #{openId}")
    User selectByOpenId(String openId);

    /**
     * 在user表里创建微信用户
     * @param user
     */
    void insertUser(User user);


    @Select("select * from user where id = #{userId}")
    User getById(Long userId);

    /**
     * 用户统计
     * @param qurayParam
     * @return
     */
    Long selectCountByMap(Map qurayParam);

    /**
     * 订单统计
     * @param qurayParam
     * @return
     */
    Long selectCount(Map qurayParam);
}
